﻿<UserControl x:Class="MEFedMVVMSample.Views.ContactsList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mefed="http:\\www.codeplex.com\MEFedMVVM"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             mefed:ViewModelLocator.ViewModel="ContactListViewModel" Background="White">
    
    <Grid>
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="Loading">
    			<VisualStateGroup.Transitions>
    				<VisualTransition GeneratedDuration="0:0:0.2"/>
    			</VisualStateGroup.Transitions>
    			<VisualState x:Name="LoadingContacts">
    				<Storyboard>
    					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
    						<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
    					</DoubleAnimationUsingKeyFrames>
    					<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="border">
    						<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
    					</BooleanAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    			<VisualState x:Name="ContactsLoaded"/>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<Border Margin="5,0,5,10" BorderBrush="Black" BorderThickness="0,0,0,2">
			<StackPanel Orientation="Horizontal" Margin="5">
				<TextBlock Text="Search:" VerticalAlignment="Center" FontSize="13.333"/>
				<TextBox Margin="10,0,0,0" FontSize="10" MinWidth="200" Name="searchText"/>
				<Button Content=">>" VerticalAlignment="Center" Margin="5,2,0,2" Command="{Binding SearchCommand}" CommandParameter="{Binding ElementName=searchText, Path=Text}" />
			</StackPanel>
		</Border>
		<ScrollViewer Grid.Row="1" Style="{DynamicResource FavsScrollViewer}">
	        <ItemsControl ItemsSource="{Binding Contacts}" >
	            <ItemsControl.ItemTemplate>
	                <DataTemplate>
	                    <Border Width="200" Height="100" BorderBrush="#FF686767" BorderThickness="2" CornerRadius="5" Margin="0,2" Background="#FFCECCCC" Padding="5">
	                    	<Border.Effect>
	                    		<DropShadowEffect Opacity="0.3"/>
	                    	</Border.Effect>
	                        <StackPanel VerticalAlignment="Center">
	                        	<TextBlock Text="{Binding Name, StringFormat=Name: \{0\}}" FontSize="13.333"/>
								<TextBlock Text="{Binding Surname, StringFormat=Surname: \{0\}}" FontSize="13.333"/>
								<TextBlock Text="{Binding EMail}" FontSize="13.333"/>
	                        </StackPanel>
	                    </Border>
	                </DataTemplate>
	            </ItemsControl.ItemTemplate>
	        </ItemsControl>
		</ScrollViewer>
		
		<Border x:Name="border" Background="#CCADABAB" Opacity="0" IsHitTestVisible="False" Grid.RowSpan="3">
			<TextBlock Text="Loading contacts..." HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="26.667"/>
		</Border>
    </Grid>
    
</UserControl>
